package com.lijie.bs_recruit.controller;


import com.github.pagehelper.PageInfo;
import com.lijie.bs_recruit.model.Position;
import com.lijie.bs_recruit.service.PositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 李杰
 * @since 2021-03-15
 */
@RestController
@RequestMapping("/admin/position")
public class PositionAdminController {
    @Autowired
    PositionService positionService;

    //更具审核条件查询所有职位
    @RequestMapping("/selPositionByChecked/{currPage}")
    public PageInfo<Position> selCheckedPosition(@PathVariable Integer currPage , @RequestBody Position position){

        PageInfo<Position> positionPage = positionService.selPositionPage(currPage,position);
        return positionPage;
    }
//    //更具删除字段查询所有职位   0-未删除、1-已删除
//    @RequestMapping("/selPositionByDeleted/{isDeleted}")
//    public List<Position> selPositionByDeleted(@PathVariable Integer isDeleted){
//        List<Position> positions = positionService.selCheckedPositionPage(null,isDeleted);
//        return positions;
//    }
    //更新审核状态
    @RequestMapping("/updatePositionCheck")
    public Boolean updatePositionCheck (@RequestBody Position position){
        Boolean aBoolean=false ;
        if (position.getPositionId()!=null&&position.getIscheck()!=null){
            aBoolean= positionService.updatePositionCheck(position);
        }
        return aBoolean;
    }





}

